package com.it.emall.service.impl;

import com.it.emall.domain.Recipes;
import com.it.emall.mapper.RecipeMapper;
import com.it.emall.service.RecipesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 食谱service
 */
@Service
public class RecipesServiceImpl implements RecipesService {



    @Autowired
    private RecipeMapper recipeMapper;
    @Override
    public List<Recipes> selectRecipesList(Integer recipesId, String name) {
        return recipeMapper.selectRecipes(recipesId,name);
    }



    /**
     * 后台
     */
    @Override
    public List<Recipes> selectManageRecipes() {
        return recipeMapper.selectManageRecipes();
    }
    @Override
    public List<Recipes> searchRecipes(String recipeName, String category, String description, String instructions) {
        return recipeMapper.searchManageRecipes(recipeName, category, description, instructions);
    }

    @Override
    public int addRecipe(Recipes recipe) {
        return recipeMapper.insertManageRecipe(recipe);
    }

    @Override
    public int updateRecipe(Recipes recipe) {

        return  recipeMapper.updateManageRecipe(recipe);
    }

    @Override
    public int deleteRecipe(Integer id) {
        return  recipeMapper.deleteManageRecipe(id);
    }

}
